package com.hadoop.mr.amiudake.wordcount;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class WordCountReduce extends Reducer<Text, LongWritable, Text, LongWritable>{

	@Override
	protected void reduce(Text key, Iterable<LongWritable> valuse, Reducer<Text, LongWritable, Text, LongWritable>.Context context)
			throws IOException, InterruptedException {
		System.out.println(key);
		long count = 0L;
		for (LongWritable v : valuse) {
			count = count + v.get();
		}
		context.write(key, new LongWritable(count));
		
	}

	
}
